(Fx_selection_exists_p): Handle nil, t as SELECTION arg.
authorRichard M. Stallman <rms@gnu.org>
Sat, 15 May 1993 19:00:34 +0000 (19:00 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 15 May 1993 19:00:34 +0000 (19:00 +0000)
Don't die if SELECTION is not recognized.

src/xselect.c

index bb052ae1ccf1359f7daf3c2d297628e93c770a69..ca756646cd0e59be74f497db4a1906a8330f6fa3 100644 (file)
@@ -1679,12 +1679,18 @@ and t is the same as `SECONDARY'.)")
      Lisp_Object selection;
 {
   Window owner;
+  Atom atom;
   Display *dpy = x_current_display;
   CHECK_SYMBOL (selection, 0);
   if (!NILP (Fx_selection_owner_p (selection)))
     return Qt;
+  if (EQ (selection, Qnil)) selection = QPRIMARY;
+  if (EQ (selection, Qt)) selection = QSECONDARY;
+  atom = symbol_to_x_atom (dpy, selection);
+  if (atom == 0)
+    return Qnil;
   BLOCK_INPUT;
-  owner = XGetSelectionOwner (dpy, symbol_to_x_atom (dpy, selection));
+  owner = XGetSelectionOwner (dpy, atom);
   UNBLOCK_INPUT;
   return (owner ? Qt : Qnil);
 }